package com.zhxt.web.controller.reportapi;

import com.zhxt.common.annotation.Log;
import com.zhxt.common.core.controller.BaseController;
import com.zhxt.common.core.domain.AjaxResult;
import com.zhxt.common.core.page.TableDataInfo;
import com.zhxt.common.enums.BusinessType;
import com.zhxt.system.domain.ZhxtContent;
import com.zhxt.system.domain.ZhxtContribute;
import com.zhxt.system.service.IAboutService;
import com.zhxt.system.service.IZhxtContentService;
import com.zhxt.system.service.IZhxtContributeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 厚重河南
 *
 * @author zhxt
 */

@RestController
@RequestMapping("/repapi/hzhn")
public class HzhnController extends BaseController {
    //公司简介
    @Autowired
    private IAboutService iAboutService;

    //内容处理
    @Autowired
    private IZhxtContentService iZhxtContentService;

    //凌烟阁处理
    @Autowired
    private IZhxtContributeService iZhxtContributeService;

    /**
     * 查询公司简介
     */
    @Log(title = "大屏-查看公司简介", businessType = BusinessType.OTHER)
    @PostMapping("/getAbout")
    public AjaxResult getAbout(){
        AjaxResult ajax=AjaxResult.success();
        ajax.put("about",iAboutService.getAboutList()==null?new ArrayList<>():iAboutService.getAboutList());
        return ajax;
    }

    /**
     * 查询大事记接口-分页
     */
    @Log(title = "大屏-查看大事记", businessType = BusinessType.OTHER)
    @PostMapping("/getEventList")
    public TableDataInfo getEventList(ZhxtContent zhxtContent){
        startPage();
        List<ZhxtContent> zhxtContentsList = iZhxtContentService.getContentList(zhxtContent);
        return getDataTable(zhxtContentsList==null?new ArrayList<>():zhxtContentsList);
    }

    /**
     * 查询党建工团
     */
    @Log(title = "大屏-查看党建工团", businessType = BusinessType.OTHER)
    @PostMapping("/getUnionList")
    public TableDataInfo getUnionList(ZhxtContent zhxtContent){
        startPage();
        List<ZhxtContent> zhxtContentsList = iZhxtContentService.getContentList(zhxtContent);
        return getDataTable(zhxtContentsList==null?new ArrayList<>():zhxtContentsList);
    }

    /**
     * 查询党建工团详细信息查询
     */
    @PostMapping("/getUnionMsg")
    public AjaxResult getUnionMsg(Long nrid){
        AjaxResult ajax=AjaxResult.success();
        Map msg = iZhxtContentService.getContentMsg(nrid);
        ajax.put("content",msg==null?new HashMap<>():msg);
        return ajax;
    }

    /**
     * 查询公司荣誉列表
     */
    @Log(title = "大屏-查看公司荣誉", businessType = BusinessType.OTHER)
    @PostMapping("/getHonourList")
    public TableDataInfo getHonourList(ZhxtContent zhxtContent){
        startPage();
        List<ZhxtContent> zhxtContentsList = iZhxtContentService.getContentList(zhxtContent);
        return getDataTable(zhxtContentsList==null?new ArrayList<>():zhxtContentsList);
    }

    /**
     * 查询凌烟阁列表
     */
    @Log(title = "大屏-查看名人堂", businessType = BusinessType.OTHER)
    @PostMapping("/getContributeList")
    public TableDataInfo getContributeList(ZhxtContribute zhxtContribute){
        startPage();
        List<ZhxtContribute> zhxtContributeList = iZhxtContributeService.getZhxtContributeList(zhxtContribute);
        return getDataTable(zhxtContributeList==null?new ArrayList<>():zhxtContributeList);
    }
}
